Interface SystemFileManager

All Superinterfaces:
IPCObject
All Known Implementing Classes:
SystemFileManagerImpl

public interface SystemFileManager extends IPCObject
Information provided by the PKI file:

    \class SystemFileManager
    
    \brief SystemFileManager provides file IO to the local system.
    
    \example systemFileManager()
    
Author:
Auto-generated
  • Method Details

    • getOpenFileName

      String getOpenFileName(String caption, String path, String filters)
      Information provided by the PKI file:
      
          \brief Prompt the user to select a file to open. It blocks until the user has selected or canceled the dialog.
          
          \param caption, the title of the open dialog
          \param path, the default full path
          \param filter, the filter of files to show in open dialog in the following format:
          <filter>[;;<filter[...]]]
          where each <filter> is in the following format:
          <name>(*.<extension>[ *.<extension>[...]])
          
          example: "Packet Tracer Activity Sequencer File (*.pks *.pksz);;Zip File (*.zip)"
          \return QString, the full path of the selected file
          
              
      Parameters:
      caption - Takes in a parameter of caption
      path - Takes in a parameter of path
      filters - Takes in a parameter of filters
      Returns:
      String Returns a String
    • getOpenFileNames

      List<String> getOpenFileNames(String caption, String path, String filters)
      Information provided by the PKI file:
      
          \brief Prompt the user to select one or multiple files to open. It blocks until the user has selected or canceled the dialog.
          
          \param caption, the title of the open dialog
          \param path, the default full path
          \param filter, the filter of files to show in open dialog in the following format:
          <filter>[;;<filter[...]]]
          where each <filter> is in the following format:
          <name>(*.<extension>[ *.<extension>[...]])
          
          example: "Packet Tracer Activity Sequencer File (*.pks *.pksz);;Zip File (*.zip)"
          \return vector<QString>, the full path of the selected files
          
              
      Parameters:
      caption - Takes in a parameter of caption
      path - Takes in a parameter of path
      filters - Takes in a parameter of filters
      Returns:
      List<String> Returns a List<String>
    • getSaveFileName

      String getSaveFileName(String caption, String path, String filters)
      Information provided by the PKI file:
      
          \brief Prompt the user to select a file to save. It blocks until the user has selected or canceled the dialog.
          
          \param caption, the title of the save dialog
          \param path, the default full path
          \param filter, the filter of files to show in save dialog in the following format:
          <filter>[;;<filter[...]]]
          where each <filter> is in the following format:
          <name>(*.<extension>[ *.<extension>[...]])
          
          example: "Packet Tracer Activity Sequencer File (*.pks *.pksz);;Zip File (*.zip)"
          \return QString, the full path of the selected file
          
              
      Parameters:
      caption - Takes in a parameter of caption
      path - Takes in a parameter of path
      filters - Takes in a parameter of filters
      Returns:
      String Returns a String
    • getFileContents

      String getFileContents(String filename)
      Information provided by the PKI file:
      
          \brief Returns the content of a plain text file.
          
          \param filename, the full path of the file
          
          \return QString, the content of the file
          
              
      Parameters:
      filename - Takes in a parameter of filename
      Returns:
      String Returns a String
    • getFileBinaryContents

      String getFileBinaryContents(String filename)
      Information provided by the PKI file:
      
          \brief Returns the content of a binary file in base 64 format.
          
          \param filename, the full path of the file
          
          \return QString, the content of the file
          
              
      Parameters:
      filename - Takes in a parameter of filename
      Returns:
      String Returns a String
    • writeTextToFile

      boolean writeTextToFile(String filename, String contents64)
      Information provided by the PKI file:
      
          \brief Writes plain text content to a file using UTF-8 encoding.
          
          \param filename, the full path of the file.
          \param contents64, the content in base 64 format
          
          \return bool, true if successful, false otherwise
          
              
      Parameters:
      filename - Takes in a parameter of filename
      contents64 - Takes in a parameter of contents64
      Returns:
      boolean Returns a boolean
    • writePlainTextToFile

      boolean writePlainTextToFile(String filename, String contents)
      Information provided by the PKI file:
      
          \brief Writes plain text content to a file using UTF-8 encoding.
          
          \param filename, the full path of the file.
          \param contents, the contents
          
          \return bool, true if successful, false otherwise
          
              
      Parameters:
      filename - Takes in a parameter of filename
      contents - Takes in a parameter of contents
      Returns:
      boolean Returns a boolean
    • writeBinaryToFile

      boolean writeBinaryToFile(String filename, String contents64)
      Information provided by the PKI file:
      
          \brief Writes binary content to a file.
          
          \param filename, the full path of the file.
          \param contents64, the content in base 64 format
          
          \return bool, true if successful, false otherwise
          
              
      Parameters:
      filename - Takes in a parameter of filename
      contents64 - Takes in a parameter of contents64
      Returns:
      boolean Returns a boolean
    • getFileSize

      int getFileSize(String path)
      Information provided by the PKI file:
      
          \brief Returns the size of a file in bytes.
          
          \param path, the full path of the file.
          
          \return int, size of file in bytes
          
              
      Parameters:
      path - Takes in a parameter of path
      Returns:
      int Returns a int
    • getFileCheckSum

      String getFileCheckSum(String path)
      Information provided by the PKI file:
      
          \brief Returns the SHA-1 checksum of a file.
          
          \param path, the full path of the file.
          
          \return QString, the SHA-1 checksum of the file
          
              
      Parameters:
      path - Takes in a parameter of path
      Returns:
      String Returns a String
    • getFileModificationTime

      long getFileModificationTime(String path)
      Information provided by the PKI file:
      
          \brief Returns the last modification time of a file in number of seconds that have passed since 1970-01-01T00:00:00 UTC.
          
          \param path, the full path of the file.
          
          \return int, last modification time in number of seconds that have passed since 1970-01-01T00:00:00 UTC.
          
              
      Parameters:
      path - Takes in a parameter of path
      Returns:
      long Returns a long
    • getFilePermissions

      FilePermissions getFilePermissions(String path)
      Information provided by the PKI file:
      
          \brief Returns the permissions of a file.
          
          \param path, the full path of the file.
          
          \return int, the permissions of the file.
          
              
      Parameters:
      path - Takes in a parameter of path
      Returns:
      FilePermissions Returns a FilePermissions
    • setFilePermissions

      boolean setFilePermissions(String path, FilePermissions permissions)
      Information provided by the PKI file:
      
          \brief Sets the permissions of a file.
          
          \param path, the full path of the file.
          \param int, standard Unix permissions format
          
          \return bool, true if successful, false otherwise
          
              
      Parameters:
      path - Takes in a parameter of path
      permissions - Takes in a parameter of permissions
      Returns:
      boolean Returns a boolean
    • copySrcFileToDestFile

      boolean copySrcFileToDestFile(String srcFile, String destFile)
      Information provided by the PKI file:
      
          \brief Copies a file.
          
          \param srcFile, the full path of the source
          \param destFile, the full path of the destination
          
          \return bool, true if successful, false otherwise
          
              
      Parameters:
      srcFile - Takes in a parameter of srcFile
      destFile - Takes in a parameter of destFile
      Returns:
      boolean Returns a boolean
    • moveSrcFileToDestFile

      boolean moveSrcFileToDestFile(String srcFile, String destFile, boolean bReplace)
      Information provided by the PKI file:
      
          \brief Moves or renames a file.
          
          \param srcFile, the full path of the source
          \param destFile, the full path of the destination
          \param bReplace, true if to replace, false otherwise
          
          \return bool, true if successful, false otherwise
          
              
      Parameters:
      srcFile - Takes in a parameter of srcFile
      destFile - Takes in a parameter of destFile
      bReplace - Takes in a parameter of bReplace
      Returns:
      boolean Returns a boolean
    • copySrcDirectoryToDestDirectory

      boolean copySrcDirectoryToDestDirectory(String srcDir, String destDir, boolean bReplace, FilePermissions permissions)
      Information provided by the PKI file:
      
          \brief Copies a directory.
          
          \param srcDir, the full path of the source
          \param destDir, the full path of the destination
          \param bReplace, true if to replace, false otherwise
          \param permissions, standard Unix permissions format
          
          \return bool, true if successful, false otherwise
          
              
      Parameters:
      srcDir - Takes in a parameter of srcDir
      destDir - Takes in a parameter of destDir
      bReplace - Takes in a parameter of bReplace
      permissions - Takes in a parameter of permissions
      Returns:
      boolean Returns a boolean
    • moveSrcDirectoryToDestDirectory

      boolean moveSrcDirectoryToDestDirectory(String srcDir, String destDir, boolean bReplace)
      Information provided by the PKI file:
      
          \brief Moves or renames a directory.
          
          \param srcDir, the full path of the source
          \param destDir, the full path of the destination
          \param bReplace, true if to replace, false otherwise
          
          \return bool, true if successful, false otherwise
          
              
      Parameters:
      srcDir - Takes in a parameter of srcDir
      destDir - Takes in a parameter of destDir
      bReplace - Takes in a parameter of bReplace
      Returns:
      boolean Returns a boolean
    • zipDirectory

      boolean zipDirectory(String path)
      Information provided by the PKI file:
      
          \brief Zips up a directory into a zip file with the same name.
          
          \param path, the full path of the directory
          \param password, the password to use to encrypt the zip
          
          \return bool, true if successful, false otherwise
          
              
      Parameters:
      path - Takes in a parameter of path
      Returns:
      boolean Returns a boolean
    • zipDirectoryWithPassword

      boolean zipDirectoryWithPassword(String path, String password)
      Parameters:
      path - Takes in a parameter of path
      password - Takes in a parameter of password
      Returns:
      boolean Returns a boolean
    • zipDirectoryTo

      boolean zipDirectoryTo(String path, String dstFile)
      Information provided by the PKI file:
      
          \brief Zips up a directory into a zip file.
          
          \param path, the full path of the directory
          \param dstFile, the full path of the destination zip file
          \param password, the password to use to encrypt the zip
          
          \return bool, true if successful, false otherwise
          
              
      Parameters:
      path - Takes in a parameter of path
      dstFile - Takes in a parameter of dstFile
      Returns:
      boolean Returns a boolean
    • zipDirectoryToWithPassword

      boolean zipDirectoryToWithPassword(String path, String dstFile, String password)
      Parameters:
      path - Takes in a parameter of path
      dstFile - Takes in a parameter of dstFile
      password - Takes in a parameter of password
      Returns:
      boolean Returns a boolean
    • unzipFile

      boolean unzipFile(String filePath)
      Information provided by the PKI file:
      
          \brief Unzips up a file in the same directory with the same name.
          
          \param filePath, the full path of the zip file
          \param password, the password to use to decrypt the encrypted zip
          
          \return bool, true if successful, false otherwise
          
              
      Parameters:
      filePath - Takes in a parameter of filePath
      Returns:
      boolean Returns a boolean
    • unzipFileWithPassword

      boolean unzipFileWithPassword(String filePath, String password)
      Parameters:
      filePath - Takes in a parameter of filePath
      password - Takes in a parameter of password
      Returns:
      boolean Returns a boolean
    • unzipFileTo

      boolean unzipFileTo(String filePath, String dstPath)
      Information provided by the PKI file:
      
          \brief Unzips up a file in the same directory to a specified directory.
          
          \param filePath, the full path of the zip file
          \param dstPath, the full path of the destination directory
          \param password, the password to use to decrypt the encrypted zip
          
          \return bool, true if successful, false otherwise
          
              
      Parameters:
      filePath - Takes in a parameter of filePath
      dstPath - Takes in a parameter of dstPath
      Returns:
      boolean Returns a boolean
    • unzipFileToWithPassword

      boolean unzipFileToWithPassword(String filePath, String dstPath, String password)
      Parameters:
      filePath - Takes in a parameter of filePath
      dstPath - Takes in a parameter of dstPath
      password - Takes in a parameter of password
      Returns:
      boolean Returns a boolean
    • encrypt

      String encrypt(String data, String password)
      Information provided by the PKI file:
      
          \brief FOR INTERNAL USE ONLY. Encrypts the string using password. Returns empty string if not internal script module or exapps.
          
          \param data, the string to be encrypted
          \param password, the password to use to encrypt
          
          \return QString, the encrypted data in base 64 format
          
              
      Parameters:
      data - Takes in a parameter of data
      password - Takes in a parameter of password
      Returns:
      String Returns a String
    • decrypt

      String decrypt(String data, String password)
      Information provided by the PKI file:
      
          \brief FOR INTERNAL USE ONLY. Decrypts the data using password. Returns empty string if not internal script module or exapps.
          
          \param data, the data to be decrypted in base 64 format
          \param password, the password to use to decrypt
          
          \return QString, the decrypted string
          
              
      Parameters:
      data - Takes in a parameter of data
      password - Takes in a parameter of password
      Returns:
      String Returns a String
    • encryptBinary

      String encryptBinary(String data64, String password)
      Information provided by the PKI file:
      
          \brief FOR INTERNAL USE ONLY. Encrypts the binary data using password. Returns empty string if not internal script module or exapps.
          
          \param data64, the binary data to be encrypted in base 64 format
          \param password, the password to use to encrypt
          
          \return QString, the encrypted data in base 64 format
          
              
      Parameters:
      data64 - Takes in a parameter of data64
      password - Takes in a parameter of password
      Returns:
      String Returns a String
    • decryptBinary

      String decryptBinary(String data64, String password)
      Information provided by the PKI file:
      
          \brief FOR INTERNAL USE ONLY. Decrypts the data using password. Returns empty string if not internal script module or exapps.
          
          \param data64, the data to be decrypted in base 64 format
          \param password, the password to use to decrypt
          
          \return QString, the decrypted data in base 64 format
          
              
      Parameters:
      data64 - Takes in a parameter of data64
      password - Takes in a parameter of password
      Returns:
      String Returns a String
    • getEncryptedFileContents

      String getEncryptedFileContents(String filename, String password)
      Information provided by the PKI file:
      
          \brief FOR INTERNAL USE ONLY. Reads and decrypts the file content using password. Returns empty string if not internal script module or exapps.
          
          \param filename, the full path to the file
          \param password, the password to use to decrypt
          
          \return QString, the decrypted string
          
              
      Parameters:
      filename - Takes in a parameter of filename
      password - Takes in a parameter of password
      Returns:
      String Returns a String
    • getEncryptedFileBinaryContents

      String getEncryptedFileBinaryContents(String filename, String password)
      Information provided by the PKI file:
      
          \brief FOR INTERNAL USE ONLY. Reads and decrypts the binary file content using password. Returns empty string if not internal script module or exapps.
          
          \param filename, the full path to the file
          \param password, the password to use to decrypt
          
          \return QString, the decrypted data in base 64 format
          
              
      Parameters:
      filename - Takes in a parameter of filename
      password - Takes in a parameter of password
      Returns:
      String Returns a String
    • writeTextToEncryptedFile

      boolean writeTextToEncryptedFile(String filename, String contents, String password)
      Information provided by the PKI file:
      
          \brief FOR INTERNAL USE ONLY. Encrypts the text content using password and writes to file. Returns false if not internal script module or exapps.
          
          \param filename, the full path to the file
          \param contents, the text content
          \param password, the password to use to encrypt
          
          \return bool, true if successful, false otherwise
          
              
      Parameters:
      filename - Takes in a parameter of filename
      contents - Takes in a parameter of contents
      password - Takes in a parameter of password
      Returns:
      boolean Returns a boolean
    • writeBinaryToEncryptedFile

      boolean writeBinaryToEncryptedFile(String filename, String contents64, String password)
      Information provided by the PKI file:
      
          \brief FOR INTERNAL USE ONLY. Encrypts the binary content using password and writes to file. Returns false if not internal script module or exapps.
          
          \param filename, the full path to the file
          \param contents64, the data in base 64 format
          \param password, the password to use to encrypt
          
          \return bool, true if successful, false otherwise
          
              
      Parameters:
      filename - Takes in a parameter of filename
      contents64 - Takes in a parameter of contents64
      password - Takes in a parameter of password
      Returns:
      boolean Returns a boolean
    • writeTextToEncryptedLogFile

      boolean writeTextToEncryptedLogFile(String filename, String contents)
      Information provided by the PKI file:
      
          \brief FOR INTERNAL USE ONLY. Encrypts the text content using same method as PT log file format and writes to file. Returns false if not internal script module or exapps.
          
          \param filename, the full path to the file
          \param contents, the text content
          
          \return bool, true if successful, false otherwise
          
              
      Parameters:
      filename - Takes in a parameter of filename
      contents - Takes in a parameter of contents
      Returns:
      boolean Returns a boolean
    • encryptFile

      boolean encryptFile(String srcFile, String dstFile, String password)
      Information provided by the PKI file:
      
          \brief FOR INTERNAL USE ONLY. Encrypts a file using password and writes to another file. Returns false if not internal script module or exapps.
          
          \param srcFile, the full path to the source file
          \param dstFile, the full path of the destination file
          \param password, the password to use to encrypt
          
          \return bool, true if successful, false otherwise
          
              
      Parameters:
      srcFile - Takes in a parameter of srcFile
      dstFile - Takes in a parameter of dstFile
      password - Takes in a parameter of password
      Returns:
      boolean Returns a boolean
    • decryptFile

      boolean decryptFile(String srcFile, String dstFile, String password)
      Information provided by the PKI file:
      
          \brief FOR INTERNAL USE ONLY. Decrypts a file using password and writes to another file. Returns false if not internal script module or exapps.
          
          \param srcFile, the full path to the source file
          \param dstFile, the full path of the destination file
          \param password, the password to use to decrypt
          
          \return bool, true if successful, false otherwise
          
              
      Parameters:
      srcFile - Takes in a parameter of srcFile
      dstFile - Takes in a parameter of dstFile
      password - Takes in a parameter of password
      Returns:
      boolean Returns a boolean
    • makeDirectory

      boolean makeDirectory(String path)
      Information provided by the PKI file:
      
          \brief Creates a directory including all missing parents.
          
          \param path, the full path of the directory
          
          \return bool, true if successful, false otherwise
          
              
      Parameters:
      path - Takes in a parameter of path
      Returns:
      boolean Returns a boolean
    • removeFile

      boolean removeFile(String filePath)
      Information provided by the PKI file:
      
          \brief Removes a file.
          
          \param path, the full path of the file
          
          \return bool, true if successful, false otherwise
          
              
      Parameters:
      filePath - Takes in a parameter of filePath
      Returns:
      boolean Returns a boolean
    • removeDirectory

      boolean removeDirectory(String dirPath)
      Information provided by the PKI file:
      
          \brief Removes a directory recursively including all sub directories and files.
          
          \param path, the full path of the directory
          
          \return bool, true if successful, false otherwise
          
              
      Parameters:
      dirPath - Takes in a parameter of dirPath
      Returns:
      boolean Returns a boolean
    • directoryExists

      boolean directoryExists(String path)
      Information provided by the PKI file:
      
          \brief Returns whether a directory exists.
          
          \param path, the full path of the directory
          
          \return bool, true if it exists and is a directory, false otherwise
          
              
      Parameters:
      path - Takes in a parameter of path
      Returns:
      boolean Returns a boolean
    • fileExists

      boolean fileExists(String path)
      Information provided by the PKI file:
      
          \brief Returns whether a file exists.
          
          \param path, the full path of the file
          
          \return bool, true if it exists and is a file, false otherwise
          
              
      Parameters:
      path - Takes in a parameter of path
      Returns:
      boolean Returns a boolean
    • convertToNativeSeparators

      String convertToNativeSeparators(String path)
      Information provided by the PKI file:
      
          \brief Converts a path to native format with native separators.
          
          \param path, a path name
          
          \return QString, the path converted to native format
          
              
      Parameters:
      path - Takes in a parameter of path
      Returns:
      String Returns a String
    • convertFromNativeSeparators

      String convertFromNativeSeparators(String path)
      Information provided by the PKI file:
      
          \brief Converts a path to Unix format with Unix separators.
          
          \param path, a path name
          
          \return QString, the path converted to Unix format
          
              
      Parameters:
      path - Takes in a parameter of path
      Returns:
      String Returns a String
    • isAbsolutePath

      boolean isAbsolutePath(String path)
      Information provided by the PKI file:
      
          \brief Returns whether the path is absolute.
          
          \param path, a path name
          
          \return bool, whether the path is absolute.
          
              
      Parameters:
      path - Takes in a parameter of path
      Returns:
      boolean Returns a boolean
    • isRelativePath

      boolean isRelativePath(String path)
      Information provided by the PKI file:
      
          \brief Returns whether the path is relative.
          
          \param path, a path name
          
          \return bool, whether the path is relative.
          
              
      Parameters:
      path - Takes in a parameter of path
      Returns:
      boolean Returns a boolean
    • getRelativePath

      String getRelativePath(String path1, String path2)
      Information provided by the PKI file:
      
          \brief Returns path name of path2 relative to path1.
          
          \param path1, the full base path name
          \param path2, the full sub path name
          
          \return QString, the path name of path2 relative to path1.
          
              
      Parameters:
      path1 - Takes in a parameter of path1
      path2 - Takes in a parameter of path2
      Returns:
      String Returns a String
    • getAbsolutePath

      String getAbsolutePath(String path)
      Information provided by the PKI file:
      
          \brief Returns absolute path name.
          
          \param path, a path anme
          
          \return QString, absolute path name.
          
              
      Parameters:
      path - Takes in a parameter of path
      Returns:
      String Returns a String
    • getFilesInDirectory

      List<String> getFilesInDirectory(String path)
      Information provided by the PKI file:
      
          \brief Returns a list of files and directory names in a directory.
          
          \param path, the full path of the directory
          
          \return vector<QString>, the list of files and directory names
          
              
      Parameters:
      path - Takes in a parameter of path
      Returns:
      List<String> Returns a List<String>
    • getFileWatcher

      SystemFileWatcher getFileWatcher()
      Information provided by the PKI file:
      
          \brief Returns the SystemFileWatcher instance for this Script Module. This is not available for ExApps and will return NULL.
          
          \return SystemFileWatcher, the instance for this Script Module
          
              
      Returns:
      SystemFileWatcher Returns a SystemFileWatcher